home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 4 / Meeting Pearls Vol. IV (1996)(GTI - Schatztruhe)[!].iso / Pearls / etech / GALer20 / Source / GALer / GAL.c < prev    next >
C/C++ Source or Header  |  1996-04-05  |  40KB  |  1,460 lines

  1. /******************************************************************************
  2. ** GAL.c
  3. *******************************************************************************
  4. **
  5. ** description:
  6. **
  7. ** This file containts routines for reading and programming GALs
  8. **
  9. ******************************************************************************/
  10.  
  11.  
  12.  
  13.  
  14.  
  15. /********************************* includes **********************************/
  16.  
  17. #include <exec/types.h>
  18. #include <intuition/intuition.h>
  19. #include <ctype.h>
  20. #include <stdio.h>
  21. #include <string.h>
  22.  
  23. #include <proto/locale.h>
  24.  
  25. #include "GALer.h"
  26. #include "Localize.h"
  27.  
  28.  
  29.  
  30.  
  31.  
  32. /********************************** defines **********************************/
  33.  
  34.  
  35.  
  36.  
  37.  
  38. /******************************** functions **********************************/
  39.  
  40.  
  41.  
  42.  
  43.  
  44. /******************************** variables **********************************/
  45.  
  46. extern  struct AppString { LONG   as_ID;
  47.                            STRPTR as_Str;
  48.                          };
  49.  
  50. extern  struct AppString AppStrings[];
  51.  
  52. extern  char    path[];
  53. extern  int     GALType, JedecSecurity, JedecGALType;
  54. extern  struct  JedecStruct     Jedec;
  55. extern  struct  Configuration   Config;
  56. extern  struct  Catalog         *catalog;
  57.  
  58.  
  59. int     MaxFuseAdr, SigAdr, RowSize, XORSize;
  60.  
  61. extern  long    prog_time, bulk_time;
  62.  
  63. struct  JedecStruct     Jedec2;
  64.  
  65.  
  66. UBYTE   SignatureTxt[] = "Signature: $00 $00 $00 $00 $00 $00 $00 $00  :  XXXXXXXX";
  67. UBYTE   PTTxt[]        = "PT: 0000000000000000000000000000000000000000000000000000000000000000";
  68. UBYTE   ConTxt[]       = "XOR(n): 00000000    SYN: 0    AC0: 0";
  69. UBYTE   AC1Txt[]       = "AC1(n): 00000000";
  70. UBYTE   XOR10Txt[]     = "XOR(23-14): 0000000000";
  71. UBYTE   SYN10Txt[]     = "SYN(23-14): 0000000000";
  72.  
  73.  
  74. UBYTE *CmpText1, *CmpText2, *CmpText3, *CmpText4;
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. /******************************************************************************
  83. ** ProgramGAL()
  84. *******************************************************************************
  85. ** input:   none
  86. ** output:  none
  87. **
  88. ** remarks: This function does read a JEDEC file. According to this JEDEC
  89. **          file a GAL is programmed.
  90. ******************************************************************************/
  91.  
  92. void ProgramGAL(void)
  93. {
  94.  
  95.     if (GALTypeRequest(AppStrings[MSG_GAL_PROG].as_Str))
  96.     {
  97.         if (MyFileReq(AppStrings[MSG_LOADJED].as_Str, ".jed", YES, LOAD))
  98.         {
  99.  
  100.             if (!(GetJedec((UBYTE *)&path[0])))
  101.             {
  102.  
  103.                 if (GALType != JedecGALType)  /* does selected GAL and JEDEC */
  104.                 {                             /* match?                      */
  105.                     JedecError(25, NO);
  106.                     return;
  107.                 }
  108.  
  109.  
  110.                 if (ReadGALParameter(YES))    /* read the GAL's parameters */
  111.                     return;
  112.  
  113.                 if (!ProgJedecToGAL(PROGGAL))
  114.                 {
  115.  
  116.                     if (JedecSecurity)       /* is security bit of the JEDEC */                   /*war im Jedec-File das Sec.*/
  117.                         SetSecurity(NO);     /* file set?                    */
  118.  
  119.                     TxtRequest(AppStrings[MSG_GALPROGED].as_Str,
  120.                                AppStrings[MSG_CONT_GAD].as_Str, NULL);
  121.                 }
  122.                 else
  123.                     return;
  124.  
  125.             }
  126.         }
  127.     }
  128. }
  129.  
  130.  
  131.  
  132.  
  133.  
  134. /******************************************************************************
  135. ** CopyGAL()
  136. *******************************************************************************
  137. ** input:   none
  138. ** output:  none
  139. **
  140. ** remarks: copy GAL
  141. ******************************************************************************/
  142.  
  143. void CopyGAL(void)
  144. {
  145.     int     flag;
  146.  
  147.     if (GALTypeRequest(AppStrings[MSG_COPY_GAL].as_Str))
  148.     {
  149.  
  150.         if (ReadGALParameter(YES))         /* read GAL parameters */
  151.             return;
  152.  
  153.         PrintText(AppStrings[MSG_READING_GAL].as_Str, 1);
  154.  
  155.         ReadGALToJedec();                  /* read source GAL */
  156.  
  157.         PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  158.  
  159.  
  160.         flag = 0;
  161.  
  162.         for (;;)
  163.         {
  164.  
  165.             if (flag)
  166.                 if (!TxtRequest(AppStrings[MSG_COPY_AGAIN].as_Str,
  167.                                 AppStrings[MSG_CONT_GAD].as_Str,
  168.                                 AppStrings[MSG_CANCEL_GAD].as_Str))
  169.                     break;
  170.  
  171.             flag = 1;
  172.  
  173.             TxtRequest(AppStrings[MSG_INS_DEST_GAL].as_Str,
  174.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  175.  
  176.             if (!ReadGALParameter(YES))      /* read GAL parameters and     */
  177.                 ProgJedecToGAL(COPYGAL);     /* program the destination GAL */
  178.  
  179.         }
  180.     }
  181. }
  182.  
  183.  
  184.  
  185.  
  186.  
  187. /******************************************************************************
  188. ** Leertest() -- means something like EmptyTest()
  189. *******************************************************************************
  190. ** input:   none
  191. ** output:  none
  192. **
  193. ** remarks: checks whether or not the GAL is erased
  194. ******************************************************************************/
  195.  
  196. void Leertest(void)
  197. {
  198.     int result;
  199.  
  200.     if (GALTypeRequest(AppStrings[MSG_BLANK_TEST].as_Str))
  201.     {
  202.         if (ReadGALParameter(YES))      /* get GAL's parameters */
  203.         return;
  204.  
  205.         PrintText(AppStrings[MSG_EXE_BLANK_TEST].as_Str ,1);
  206.  
  207.         result = CheckGAL();
  208.  
  209.         PrintText(AppStrings[MSG_READY].as_Str, 0);
  210.  
  211.         if (result)
  212.             TxtRequest(AppStrings[MSG_NOT_BLANK].as_Str,
  213.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  214.         else
  215.             TxtRequest(AppStrings[MSG_BLANK].as_Str,
  216.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  217.     }
  218. }
  219.  
  220.  
  221.  
  222.  
  223.  
  224. /******************************************************************************
  225. ** CheckGAL()
  226. *******************************************************************************
  227. ** input:   none
  228. ** output:  0: GAL is empty
  229. **          1: logic matrix is empty
  230. **          2: logic matrix is empty, but not the other parts
  231. **
  232. ** remarks: check whether the GAL is empty or not
  233. **          The GAL parameters must be read before calling this function!
  234. ******************************************************************************/
  235.  
  236. int CheckGAL(void)
  237. {
  238.     int     n, row;
  239.  
  240.  
  241.  
  242.     LED(ON);
  243.     EditMode(VERIFY);               /* switch GAL into edit mode */
  244.  
  245.                                     /* read logic matrix */
  246.     for (row = 0; row <= MaxFuseAdr; row++)
  247.     {
  248.  
  249.         SetRow(row);                         /* select row */
  250.         STRImpuls(VERIFY_TIME);              /* get bits to the shift register */
  251.  
  252.         for (n = 0; n < RowSize; n++)
  253.         {      /*seriell auslesen*/
  254.  
  255.             if (!SDOut())
  256.             {                               /* read state of the SDOut output */
  257.                 ExitEditMode();
  258.                 return(1);
  259.             }
  260.  
  261.             Clock();                        /* shift next bit to the SDOut pin */
  262.         }
  263.     }
  264.  
  265.  
  266.     SetRow(SigAdr);                        /*** read signature ***/
  267.     STRImpuls(VERIFY_TIME);
  268.  
  269.     for (n = 0; n < SIG_SIZE; n++)
  270.     {
  271.  
  272.         if (!SDOut())
  273.         {
  274.             ExitEditMode();
  275.             return(2);
  276.         }
  277.  
  278.         Clock();
  279.     }
  280.  
  281.  
  282.                                         /*** ACW holen ***/
  283.     if ((GALType == GAL16V8) || (GALType == GAL20V8))
  284.     {
  285.         SetRow(ACW_ADR);                        /* select ACW   */
  286.         STRImpuls(VERIFY_TIME);                 /* get ACW bits */
  287.  
  288.         for (n = 0; n < ACW_SIZE; n++)
  289.         {
  290.  
  291.             if (!SDOut())
  292.             {
  293.                 ExitEditMode();
  294.                 return(2);
  295.             }
  296.  
  297.             Clock();
  298.  
  299.         }
  300.  
  301.     }
  302.                                         /*** GAL22V10 ***/
  303.  
  304.     if (GALType == GAL22V10)
  305.     {
  306.         SetARCH(1);                             /* select ACW */
  307.         STRImpuls(VERIFY_TIME);                 /* get ACW bits */
  308.    
  309.         for (n = 0; n < 20; n++)
  310.         {
  311.             if (!SDOut())
  312.             {
  313.                 ExitEditMode();
  314.                 return(2);
  315.             }
  316.  
  317.             Clock();
  318.         }
  319.  
  320.     }
  321.  
  322.                                         /*** GAL20RA10 ***/
  323.     if (GALType == GAL20RA10)
  324.     {
  325.         SetARCH(1);                            /* select ACW   */
  326.         STRImpuls(VERIFY_TIME);                /* get ACW bits */
  327.  
  328.         for (n = 0; n < 10; n++)
  329.         {
  330.             if (!SDOut())
  331.             {
  332.                 ExitEditMode();
  333.                 return(2);
  334.             }
  335.  
  336.             Clock();
  337.         }
  338.  
  339.     }
  340.  
  341.  
  342.     ExitEditMode();
  343.  
  344.     return(0);                                     /* GAL is erased */
  345. }
  346.  
  347.  
  348.  
  349.  
  350.  
  351. /******************************************************************************
  352. ** TestSecurity()
  353. *******************************************************************************
  354. ** input:   none
  355. ** output:  none
  356. **
  357. ** remarks: This function does test whether or not the security bit of the GAL
  358. **          is set.
  359. **          If the security bit is set, only the logic matrix can't be read.
  360. **          So if one of the cells of the logic matrix is set equal 0 then the
  361. **          security bit can't be set. If all cells of the logic matrix are
  362. **          set to 1 and one cell of the signature or the ACW is set to 0
  363. **          then the security bit is set. If all cells are set to 1, the GAL
  364. **          is erased.
  365. ******************************************************************************/
  366.  
  367. void TestSecurity(void)
  368. {
  369.     int result;
  370.  
  371.  
  372.     if (GALTypeRequest(AppStrings[MSG_SEC_TEST].as_Str))
  373.     {
  374.  
  375.         if (ReadGALParameter(YES))         /* get the GAL's parameters */
  376.             return;
  377.  
  378.         result = CheckGAL();
  379.  
  380.         if (result == 2)
  381.             TxtRequest(AppStrings[MSG_SEC_SET].as_Str,
  382.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  383.         else
  384.  
  385.         if (result == 1)
  386.             TxtRequest(AppStrings[MSG_SEC_NOT_SET].as_Str,
  387.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  388.         else
  389.             TxtRequest(AppStrings[MSG_BLANK].as_Str,
  390.                       AppStrings[MSG_CONT_GAD].as_Str, NULL);
  391.     }
  392. }
  393.  
  394.  
  395.  
  396.  
  397.  
  398. /******************************************************************************
  399. ** Compare()
  400. *******************************************************************************
  401. ** input:   none
  402. ** output:  none
  403. **
  404. ** remarks: this function does compare GAL-GAL, GAL-JEDEC, JEDEC-GAL
  405. ******************************************************************************/
  406.  
  407. void Compare(void)
  408. {
  409.     int     n, row, cmptype, execute;
  410.     int     logic, acw, signature;
  411.     UBYTE   *text;
  412.  
  413.  
  414.     if (!(cmptype = CompareRequester()))
  415.         return;                                     /* cancel selected */
  416.  
  417.  
  418.     if (cmptype == 1)                               /* compare GAL-GAL */
  419.         if (!GALTypeRequest(AppStrings[MSG_CMP_GALGAL].as_Str))
  420.             return;
  421.  
  422.     if (cmptype == 2)                              /* compare GAL-JEDEC */
  423.         if (!GALTypeRequest(AppStrings[MSG_CMP_GALJED].as_Str))
  424.             return;
  425.  
  426.     if ((cmptype == 3) && (Config.GALTypeReq))     /* compare JEDEC-GAL */
  427.         if (!GALTypeRequest(AppStrings[MSG_CMP_JEDGAL].as_Str))
  428.             return;
  429.  
  430.  
  431.  
  432.     if (cmptype == 1 || cmptype == 2)
  433.     {
  434.  
  435.         if (ReadGALParameter(YES))          /* read the GAL's parameters */
  436.             return;
  437.  
  438.         PrintText(AppStrings[MSG_READING_GAL].as_Str, 1);
  439.  
  440.         ReadGALToJedec();                /* read GAL to the JEDEC structure */
  441.  
  442.         PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  443.     }
  444.  
  445.  
  446.  
  447.     if (cmptype == 3)
  448.     {
  449.  
  450.         if (MyFileReq(AppStrings[MSG_LOADJED].as_Str, ".jed", YES, LOAD))
  451.         {
  452.  
  453.             if (GetJedec((UBYTE *)&path[0]))    /* JEDEC file to structure */
  454.                 return;
  455.  
  456.             if (GALType != JedecGALType)        /* does selected type of GAL */
  457.             {                                   /* and JEDEC file match      */
  458.                 JedecError(25, NO);
  459.                 return;
  460.             }
  461.  
  462.         }
  463.         else
  464.             return;
  465.     }
  466.  
  467.  
  468.     for (n = 0; n < sizeof(Jedec2); n++)        /* save JEDEC structure */
  469.         Jedec2.GALLogic[n] = Jedec.GALLogic[n];
  470.  
  471.  
  472.     for (;;)
  473.     {
  474.  
  475.         execute = 1;
  476.  
  477.         if (cmptype == 1 || cmptype == 3)
  478.         {
  479.  
  480.             TxtRequest(AppStrings[MSG_GAL_TO_CMP].as_Str,
  481.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  482.  
  483.             if (!ReadGALParameter(YES))         /* read the GAL's parameters */
  484.             {
  485.                 PrintText(AppStrings[MSG_READING_GAL].as_Str, 1);
  486.  
  487.                 ReadGALToJedec();
  488.  
  489.                 PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  490.             }
  491.             else
  492.                 execute = 0;
  493.         }
  494.  
  495.  
  496.         if (cmptype == 2)
  497.         {
  498.  
  499.             if (MyFileReq(AppStrings[MSG_LOADJED].as_Str, ".jed", YES, LOAD))
  500.             {
  501.  
  502.                 if (GetJedec((UBYTE *)&path[0])) /* copy JEDEC file into */
  503.                     execute = 0;                 /* into structure       */
  504.  
  505.  
  506.                 if (GALType != JedecGALType)  /* does the selected type of GAL */
  507.                 {                             /* and the the JEDEC file match? */
  508.                     JedecError(25, NO);
  509.                     execute = 0;
  510.                 }
  511.  
  512.             }
  513.             else
  514.                 execute = 0;
  515.         }
  516.  
  517.  
  518.                                         /*** compare ***/
  519.         if (execute)
  520.         {
  521.  
  522.             logic = acw = signature = 1;
  523.  
  524.                                                     /* compare logic matrizes */
  525.             for (row = 0; row <= MaxFuseAdr; row++)
  526.             {
  527.  
  528.                 for (n = 0; n < RowSize; n++)
  529.                 {
  530.  
  531.                     if (Jedec.GALLogic[row+(MaxFuseAdr+1)*n] !=
  532.                         Jedec2.GALLogic[row+(MaxFuseAdr+1)*n])
  533.                     {
  534.                         logic = 0;
  535.                     }
  536.  
  537.                     if (!logic)
  538.                         break;
  539.                 }
  540.  
  541.                 if (!logic)
  542.                     break;
  543.             }
  544.  
  545.                                                     /* compare signatures */
  546.             for (n = 0; n < SIG_SIZE; n++)
  547.             {
  548.                 if (Jedec.GALSig[n] != Jedec2.GALSig[n])
  549.                     signature = 0;
  550.             }
  551.  
  552.                                                     /* compare ACWs */
  553.             if ((GALType == GAL16V8) || (GALType == GAL20V8))
  554.             {
  555.  
  556.                 if (Jedec.GALSYN != Jedec2.GALSYN)
  557.                     acw = 0;
  558.  
  559.                 if (Jedec.GALAC0 != Jedec2.GALAC0)
  560.                     acw = 0;
  561.  
  562.  
  563.                 for (n = 0; n < 8; n++)
  564.                     if (Jedec.GALXOR[n] != Jedec2.GALXOR[n])
  565.                         acw = 0;
  566.  
  567.                 for (n = 0; n < 8; n++)
  568.                     if (Jedec.GALAC1[n] != Jedec2.GALAC1[n])
  569.                         acw = 0;
  570.  
  571.                 for (n = 0; n < PT_SIZE; n++)
  572.                     if (Jedec.GALPT[n] != Jedec2.GALPT[n])
  573.                         acw = 0;
  574.  
  575.             }
  576.             else
  577.             {
  578.  
  579.                 for (n = 0; n < 10; n++)
  580.                     if (Jedec.GALXOR[n] != Jedec2.GALXOR[n])
  581.                         acw = 0;
  582.  
  583.                 if (GALType == GAL22V10)
  584.                     for (n = 0; n < 10; n++)
  585.                         if (Jedec.GALS1[n] != Jedec2.GALS1[n])
  586.                             acw = 0;
  587.  
  588.             }
  589.  
  590.                                     /*** show result of comparing ***/
  591.  
  592.             if (logic && acw && signature)          /* the samel? */
  593.                 text = CmpText1;
  594.  
  595.             if (!logic || !acw)                     /* not the same? */
  596.                 text = CmpText2;
  597.  
  598.             if (logic && acw && !signature)         /* the function is the same  */
  599.            text = CmpText3;                         /* but the signature differs */
  600.         }
  601.         else
  602.             text = CmpText4;                        /* canceled */
  603.  
  604.  
  605.         if (!TxtRequest(text, AppStrings[MSG_CONT_GAD].as_Str,
  606.                               AppStrings[MSG_CANCEL_GAD].as_Str))
  607.             return;
  608.  
  609.     }
  610. }
  611.  
  612.  
  613.  
  614.  
  615.  
  616. /******************************************************************************
  617. ** PrintACW()
  618. *******************************************************************************
  619. ** input:   none
  620. ** output:  none
  621. **
  622. ** remarks: this function does read and print the architecture control word
  623. **          (ACW)
  624. ******************************************************************************/
  625.  
  626. void PrintACW(void)
  627. {
  628.     BYTE    bit;
  629.     int     n, acw_num, xor_num, ac1_num ;
  630.  
  631.  
  632.  
  633.     acw_num = xor_num = ac1_num =0;
  634.  
  635.  
  636.     if (GALTypeRequest(AppStrings[MSG_READ_ACW].as_Str))
  637.     {
  638.  
  639.         if (ReadGALParameter(YES))      /* read the GAL's parameters */
  640.             return;
  641.  
  642.         LED(ON);                        /* switch on the LED */
  643.         EditMode(VERIFY);               /* switch GAL into the edit mode */
  644.  
  645.                                         /*** 16V8, 20V8 ***/
  646.         if ((GALType == GAL16V8) || (GALType == GAL20V8))
  647.         {
  648.  
  649.             SetRow(ACW_ADR);            /* select ACW */
  650.             STRImpuls(VERIFY_TIME);     /* get ACW into shift reg. */
  651.  
  652.             for (n = 0; n < ACW_SIZE; n++)  /* read the ACW */
  653.             {
  654.  
  655.                 bit = (BYTE)SDOut();
  656.                 Clock();
  657.  
  658.                                         /* standard type (no A type) */
  659.                 if (!GALAType())
  660.                 {
  661.  
  662.                     if (n < 32)         /* get PT0-31 */
  663.                     {
  664.                         PTTxt[4 + acw_num] = bit + '0';
  665.                         acw_num++;
  666.                     }
  667.  
  668.                     if (n >= 50)        /* get PT32-63 */
  669.                     {
  670.                         PTTxt[4 + acw_num]=bit+'0';
  671.                         acw_num++;
  672.                     }
  673.  
  674.                     if (n == 36)                /* AC0 bit */
  675.                         ConTxt[35] = bit + '0';
  676.  
  677.                     if (n == 45)                /* SYN bit*/
  678.                         ConTxt[25] = bit + '0';
  679.  
  680.                     if ((n >= 32) && (n <= 35))     /* 4 XOR bits */
  681.                     {
  682.                         ConTxt[8 + xor_num] = bit + '0';
  683.                         xor_num++;
  684.                     }
  685.  
  686.                     if ((n >= 46) && (n <= 49))    /* 4 XOR bits */
  687.                     {
  688.                         ConTxt[8 + xor_num] = bit + '0';
  689.                         xor_num++;
  690.                     }
  691.  
  692.                     if ((n >= 37) && (n <= 44))    /* AC1 bits */
  693.                     {
  694.                         AC1Txt[8 + ac1_num] = bit + '0';
  695.                         ac1_num++;
  696.                     }
  697.  
  698.                 }
  699.                 else
  700.                 {                           /* A type GAL */
  701.  
  702.                     if ((n >= 9) && (n <= 72))      /* get PT0-63 */
  703.                     {
  704.                         PTTxt[4+acw_num]=bit+'0';
  705.                         acw_num++;
  706.                     }
  707.  
  708.                     if (n == 36)                    /* AC0 bit */
  709.                         ConTxt[35] = bit + '0';
  710.  
  711.                     if (n == 77)                    /* SYN bit */
  712.                         ConTxt[25] = bit + '0';
  713.  
  714.                     if (n <= 3)                     /* XOR bits */
  715.                     {
  716.                         ConTxt[8 + xor_num] = bit + '0';
  717.                         xor_num++;
  718.                     }
  719.  
  720.                     if (n >= 78)                    /* XOR bits */
  721.                     {
  722.                         ConTxt[8 + xor_num] = bit + '0';
  723.                         xor_num++;
  724.                     }
  725.  
  726.                     if ((n >= 5) && (n <= 8))       /* AC1 bits */
  727.                     {
  728.                         AC1Txt[8 + ac1_num] = bit + '0';
  729.                         ac1_num++;
  730.                     }
  731.  
  732.                     if ((n >= 73) && (n <= 76))     /* AC1 bits */
  733.                     {
  734.                         AC1Txt[8 + ac1_num] = bit + '0';
  735.                         ac1_num++;
  736.                     }
  737.                 }
  738.             }
  739.  
  740.             PrintText((UBYTE *)&PTTxt[0], 1);
  741.             PrintText((UBYTE *)&ConTxt[0], 1);
  742.             PrintText((UBYTE *)&AC1Txt[0], 1);
  743.         }
  744.  
  745.  
  746.                                 /*** GAL22V10 ***/
  747.         if (GALType == GAL22V10)
  748.         {
  749.             SetARCH(1);                 /* select ACW */
  750.             STRImpuls(VERIFY_TIME);     /* get ACW into the shift register */
  751.  
  752.             for (n = 0; n < 10; n++)
  753.             {
  754.                 SYN10Txt[12 + n] = SDOut() + '0';    /* get S1 */
  755.                 Clock();
  756.  
  757.                 XOR10Txt[12 + n] = SDOut() + '0';    /* get XORs */
  758.                 Clock();
  759.             }
  760.  
  761.             PrintText((UBYTE *)&XOR10Txt[0], 1);
  762.             PrintText((UBYTE *)&SYN10Txt[0], 1);
  763.         }
  764.  
  765.  
  766.                                 /*** GAL20RA10 ***/
  767.         if (GALType == GAL20RA10)
  768.         {
  769.             SetARCH(1);                 /* select ACW */
  770.             STRImpuls(VERIFY_TIME);     /* get ACW into the shift register */
  771.  
  772.             for (n = 0; n < 10; n++)
  773.             {
  774.                 XOR10Txt[12 + n] = SDOut() + '0';    /* get XORs */
  775.                 Clock();
  776.             }
  777.  
  778.             PrintText((UBYTE *)&XOR10Txt[0], 1);
  779.         }
  780.  
  781.         ExitEditMode();
  782.     }
  783. }
  784.  
  785.  
  786.  
  787.  
  788.  
  789. /******************************************************************************
  790. ** PrintSignature()
  791. *******************************************************************************
  792. ** input:   none
  793. ** output:  none
  794. **
  795. ** remarks: this function does print the GAL's signature
  796. ******************************************************************************/
  797.  
  798. void PrintSignature(void)
  799. {
  800.     UBYTE   strn[6];
  801.     BYTE    byte;
  802.     int     n;
  803.  
  804.  
  805.     if (GALTypeRequest(AppStrings[MSG_READ_SIG].as_Str))
  806.     {
  807.  
  808.         if (ReadGALParameter(YES))          /* get the GAL's parameters */
  809.             return;
  810.  
  811.  
  812.         LED(ON);                            /* switch the LED on */
  813.  
  814.         EditMode(VERIFY);                   /* switch GAL into edit mode */
  815.  
  816.  
  817.         SetRow(SigAdr);                     /* select the signature and   */
  818.         STRImpuls(VERIFY_TIME);             /* get it into the shift reg. */
  819.  
  820.                                         /*** read signature ***/
  821.         byte = 0;
  822.         for (n = 0; n < SIG_SIZE; n++)
  823.         {
  824.  
  825.             byte |= (BYTE)SDOut();              /* eight bits -> one byte */
  826.  
  827.             if (!((n+1)%8))
  828.             {                                   /* make text */
  829.  
  830.                 sprintf((char *)&strn[0], "%02x", (UWORD)byte);
  831.  
  832.                 strncpy((char *)&SignatureTxt[12 + 4*((n + 1)/8 - 1)],
  833.                         (char *)&strn[0], (size_t)2);
  834.  
  835.                 if (isprint(byte))
  836.                     SignatureTxt[47 + ((n + 1)/8 - 1)] = byte;
  837.                 else
  838.                     SignatureTxt[47 + ((n + 1)/8 - 1)] = '.';
  839.  
  840.                 byte = 0;
  841.             }
  842.  
  843.             byte <<= 1;
  844.  
  845.             Clock();
  846.         }
  847.  
  848.         ExitEditMode();                             /* exit edit mode */
  849.  
  850.         PrintText((UBYTE *)&SignatureTxt[0], 1);    /* print signature */
  851.     }
  852. }
  853.  
  854.  
  855.  
  856.  
  857.  
  858. /******************************************************************************
  859. ** ProgJedecToGAL()
  860. *******************************************************************************
  861. ** input:   mode    COPYGAL: call from copy GAL function
  862. **                  PROGGAL: call from program GAL function
  863. **
  864. ** output:  0:  successful
  865. **          1:  programming failed because GAL is not empty
  866. **          2:  verify failed
  867. **
  868. ** remarks: this function does program a GAL
  869. **          source is the JEDEC structure
  870. ******************************************************************************/
  871.  
  872. int ProgJedecToGAL(int mode)
  873. {
  874.     int     n, i, row, bit;
  875.  
  876.                                         /* execute empty test */
  877.  
  878.     if (((mode == COPYGAL) && Config.CopyEmptyTest) ||
  879.         ((mode == PROGGAL) && Config.ProgEmptyTest))
  880.     {
  881.  
  882.         PrintText(AppStrings[MSG_EXE_BLANK_TEST].as_Str, 1);
  883.  
  884.         if (CheckGAL())
  885.         {
  886.             PrintText(AppStrings[MSG_NOT_BLANK2].as_Str, 0);
  887.  
  888.             if (TxtRequest(AppStrings[MSG_NOT_BLNK_ERS].as_Str,
  889.                            AppStrings[MSG_ERASE_GAD].as_Str,
  890.                            AppStrings[MSG_CANCEL_GAD].as_Str))
  891.                 EraseIt();
  892.             else
  893.                 return(1);
  894.         }
  895.         else
  896.             PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  897.  
  898.     }
  899.  
  900.  
  901.     PrintText(AppStrings[MSG_PROGING_GAL].as_Str, 1);
  902.  
  903.  
  904.  
  905.     LED(ON);
  906.     EditMode(PROG);                         /* switch GAL into edit mode */
  907.  
  908.                                 /*** GAL16V8, GAL20V8 **/
  909.                 
  910.     if (GALType == GAL16V8 || GALType == GAL20V8)
  911.     {
  912.                                 /*** program logic matrix ***/
  913.  
  914.         for (row = 0; row <= MaxFuseAdr; row++)
  915.         {
  916.             SetRow(row);
  917.  
  918.             for (n = 0; n < RowSize; n++)
  919.             {
  920.                                      /* set SDIn input of the GAL */
  921.  
  922.                 SDIn((int)Jedec.GALLogic[row + (MaxFuseAdr + 1)*n]);
  923.  
  924.                 Clock();             /* clock bit into shift register */
  925.             }
  926.  
  927.             SetPV(PROG);                      /* set P/V to "program" */
  928.             STRImpuls(prog_time);             /* program row          */
  929.             SetPV(VERIFY);                    /* reset P/V            */
  930.         }
  931.  
  932.  
  933.  
  934.         SetRow(SigAdr);             /*** program signature ***/
  935.  
  936.         for (n = 0; n < SIG_SIZE; n++)
  937.         {
  938.             SDIn((int)Jedec.GALSig[n]);   /* set SDIn input            */
  939.             Clock();                      /* clock bit into shift reg. */
  940.         }
  941.  
  942.         SetPV(PROG);                      /* set P/V to "program" */
  943.         STRImpuls(prog_time);             /* program row          */
  944.         SetPV(VERIFY);                    /* reset P/V            */
  945.  
  946.  
  947.  
  948.  
  949.         SetRow(ACW_ADR);            /*** program ACW ***/
  950.  
  951.         for (n = 0; n < ACW_SIZE; n++)
  952.         {
  953.  
  954.             if (!GALAType())        /*** standard type of GAL (no A type) ***/
  955.             {
  956.  
  957.                 if (n <= 31)                        /* PT0-PT31 */
  958.                     bit = Jedec.GALPT[n];
  959.  
  960.                 if (n >= 32 && n <= 35)             /* 4 XOR bits */
  961.                     bit = Jedec.GALXOR[n - 32];
  962.  
  963.                 if (n == 36)                        /* AC0 bit */
  964.                     bit = Jedec.GALAC0;
  965.  
  966.                 if (n >= 37 && n <= 44)             /* AC1 bits */
  967.                     bit = Jedec.GALAC1[n - 37];
  968.  
  969.                 if (n == 45)                        /* SYN bit */
  970.                   bit = Jedec.GALSYN;
  971.  
  972.                 if (n >= 46 && n <= 49)             /* 4 XOR bits */
  973.                   bit = Jedec.GALXOR[n - 42];
  974.  
  975.                 if (n >= 50 && n <= 81)             /* PT32-PT63 */
  976.                   bit = Jedec.GALPT[n - 18];
  977.  
  978.             }
  979.             else
  980.             {                      /*** A type GAL ***/
  981.  
  982.                 if (n <= 3)                         /* 4 XOR  bits */
  983.                   bit = Jedec.GALXOR[n];
  984.  
  985.                 if (n == 4)                         /* AC0 bit */
  986.                   bit = Jedec.GALAC0;
  987.  
  988.                 if (n >= 5 && n <= 8)               /* AC1 bits */
  989.                   bit = Jedec.GALAC1[n - 5];
  990.  
  991.                 if (n >= 9 && n <= 72)              /* PT0-PT63 */
  992.                   bit = Jedec.GALPT[n - 9];
  993.  
  994.                 if (n >= 73 && n <= 76)             /* AC1 bits */
  995.                   bit = Jedec.GALAC1[n-69];
  996.  
  997.                 if (n == 77)                        /* SYN bit */
  998.                   bit = Jedec.GALSYN;
  999.  
  1000.                 if (n >= 78)                        /* XOR bits */
  1001.                   bit = Jedec.GALXOR[n-74];
  1002.  
  1003.             }
  1004.  
  1005.             SDIn((int)bit);         /* set SDIn input */
  1006.             Clock();                /* clock bit into shift register */
  1007.         }
  1008.  
  1009.         SetPV(PROG);                      /* set P/V to "program" */
  1010.         STRImpuls(prog_time);             /* program row          */
  1011.         SetPV(VERIFY);                    /* reset P/V            */
  1012.  
  1013.  
  1014.     }
  1015.     else
  1016.     {                               /*** GAL20RA10, GAL22V10 ***/
  1017.  
  1018.                                     /*** program logic matrix ***/
  1019.         for (row = 0; row <= MaxFuseAdr; row++)
  1020.         {
  1021.             for (n = 0; n < RowSize; n++)
  1022.             {
  1023.                                         /* set SDIn input */
  1024.                 SDIn((int)Jedec.GALLogic[row + (MaxFuseAdr + 1)*n]);
  1025.  
  1026.                 Clock();                /* clock bit into shift register */
  1027.             }
  1028.  
  1029.             SetRow(row);
  1030.             SDIn(0);
  1031.  
  1032.             SetPV(PROG);                      /* set P/V to "program" */
  1033.             STRImpuls(prog_time);             /* program row          */
  1034.             SetPV(VERIFY);                    /* reset P/V            */
  1035.         }
  1036.  
  1037.                                     /*** program signature ***/
  1038.  
  1039.         for (n = 0; n < SIG_SIZE; n++)
  1040.         {
  1041.             SDIn((int)Jedec.GALSig[n]);       /* set SDIn input            */
  1042.             Clock();                          /* clock bit into shift reg. */
  1043.         }
  1044.  
  1045.  
  1046.         for (n = 0; n < 132 - SIG_SIZE; n++)
  1047.         {                                    /* clock missing bits */
  1048.             SDIn(1);
  1049.             Clock();
  1050.         }
  1051.  
  1052.         SetRow(SigAdr);
  1053.         SDIn(0);
  1054.  
  1055.         SetPV(PROG);                      /* set P/V to "program" */
  1056.         STRImpuls(prog_time);             /* program row          */
  1057.         SetPV(VERIFY);                    /* reset P/V            */
  1058.  
  1059.  
  1060.                                     /*** program ACW ***/
  1061.         SetARCH(1);                 /* select ACW array */
  1062.  
  1063.         for (n = 0; n < 10; n++)
  1064.         {
  1065.             if (GALType == GAL22V10)        /* if 22V10, first SYN */
  1066.             {
  1067.  
  1068.                 SDIn((int)Jedec.GALS1[n]);
  1069.                 Clock();
  1070.             }
  1071.  
  1072.             SDIn((int)Jedec.GALXOR[n]);     /* clock XOR */
  1073.             Clock();
  1074.         }
  1075.  
  1076.         SDIn(0);
  1077.  
  1078.         SetPV(PROG);                      /* set P/V to "program" */
  1079.         STRImpuls(prog_time);             /* program row          */
  1080.         SetPV(VERIFY);                    /* reset P/V            */
  1081.  
  1082.     }
  1083.  
  1084.     ExitEditMode();                       /* exit edit mode */
  1085.  
  1086.     PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);      /* print o.k. */
  1087.  
  1088.  
  1089.  
  1090.                                 /*** execute verify ***/
  1091.  
  1092.     if (((mode == COPYGAL) && Config.CopyVerify) ||
  1093.         ((mode == PROGGAL) && Config.ProgVerify))
  1094.     {
  1095.  
  1096.         PrintText(AppStrings[MSG_VERIFYING].as_Str, 1);
  1097.  
  1098.         for (n = 0; n < sizeof(Jedec2); n++)        /* save JEDEC structure */
  1099.             Jedec2.GALLogic[n] = Jedec.GALLogic[n];
  1100.  
  1101.         ReadGALToJedec();                      /* read GAL after programming */
  1102.  
  1103.         for (i = 0; i < sizeof(Jedec); i++)     /* compare JEDEC structures */
  1104.         {
  1105.             if (Jedec.GALLogic[i] != Jedec2.GALLogic[i])
  1106.             {
  1107.                 TxtRequest(AppStrings[MSG_VERFAILED].as_Str,
  1108.                            AppStrings[MSG_CANCEL_GAD].as_Str, NULL);
  1109.  
  1110.                 PrintText(AppStrings[MSG_FAILED].as_Str, 0);
  1111.  
  1112.                                                 /* restore JEDEC structure */
  1113.                 for (i = 0; i < sizeof(Jedec2); i++)
  1114.                     Jedec.GALLogic[i] = Jedec2.GALLogic[i];
  1115.  
  1116.                 return(2);
  1117.             }
  1118.         }
  1119.  
  1120.         for (n = 0; n < sizeof(Jedec2); n++)    /* restore JEDEC structure */
  1121.             Jedec.GALLogic[n] = Jedec2.GALLogic[n];
  1122.  
  1123.         PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  1124.     }
  1125.  
  1126.     return(0);
  1127. }
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133. /******************************************************************************
  1134. ** ReadGALToJedec()
  1135. *******************************************************************************
  1136. ** input:   none but global data MaxFuseAdr, SigAdr and RowSize must be
  1137. ** output:  none
  1138. **
  1139. ** remarks: This function does read a GAL and stores the data in the
  1140. **          JEDEC structure.
  1141. ******************************************************************************/
  1142.  
  1143. void ReadGALToJedec(void)
  1144. {
  1145.     int     n, row;
  1146.     BYTE    bit;
  1147.  
  1148.  
  1149.     LED(ON);
  1150.     EditMode(VERIFY);                    /* switch GAL into verify mode */
  1151.  
  1152.                                         /*** read logic matrix ***/
  1153.     for (row = 0; row <= MaxFuseAdr; row++)
  1154.     {
  1155.         SetRow(row);                        /* set row */
  1156.  
  1157.         STRImpuls(VERIFY_TIME);             /* clock bits into shift register */
  1158.  
  1159.         for (n = 0; n < RowSize; n++)       /* read bits sequentially */
  1160.         {
  1161.             Jedec.GALLogic[row + (MaxFuseAdr + 1)*n] = (BYTE)SDOut();
  1162.  
  1163.             Clock();                        /* shift next bit to SDOut */
  1164.         }
  1165.     }
  1166.  
  1167.  
  1168.  
  1169.     SetRow(SigAdr);                     /*** read signature ***/
  1170.     STRImpuls(VERIFY_TIME);
  1171.  
  1172.     for (n = 0; n < SIG_SIZE; n++)
  1173.     {
  1174.         Jedec.GALSig[n] = (BYTE)SDOut();
  1175.         Clock();
  1176.     }
  1177.  
  1178.                                         /*** read ACW ***/
  1179.  
  1180.     if (GALType == GAL16V8 || GALType == GAL20V8)
  1181.     {
  1182.  
  1183.         SetRow(ACW_ADR);
  1184.         STRImpuls(VERIFY_TIME);             /* get bits into shift register */
  1185.  
  1186.         for (n = 0; n < ACW_SIZE; n++)
  1187.         {
  1188.  
  1189.             bit = (BYTE)SDOut();
  1190.             Clock();
  1191.  
  1192.             if (!GALAType())                /*** standard GAL type ***/
  1193.             {
  1194.  
  1195.                 if (n <= 31)
  1196.                   Jedec.GALPT[n] = bit;             /* PT0-PT31 */
  1197.  
  1198.                 if (n >= 32 && n <= 35)             /* 4 XOR bits */
  1199.                   Jedec.GALXOR[n - 32] = bit;
  1200.  
  1201.                 if (n == 36)                        /* AC0 bit */
  1202.                   Jedec.GALAC0 = bit;
  1203.  
  1204.                 if (n >= 37 && n <= 44)             /* AC1 bits */
  1205.                   Jedec.GALAC1[n - 37] = bit;
  1206.  
  1207.                 if (n == 45)                        /* SYN bit */
  1208.                   Jedec.GALSYN=bit;
  1209.  
  1210.                 if ((n >= 46) && (n <= 49))         /* 4 XOR bits */
  1211.                   Jedec.GALXOR[n - 42] = bit;
  1212.  
  1213.                 if (n >= 50 && n <= 81)             /* PT32-PT63 */
  1214.                   Jedec.GALPT[n - 18] = bit;
  1215.  
  1216.             }
  1217.             else
  1218.             {                            /*** A type GAL ***/
  1219.  
  1220.                 if (n <= 3)                         /* 4 XOR bits 19-16 */
  1221.                   Jedec.GALXOR[n] = bit;
  1222.  
  1223.                 if (n == 4)                         /* AC0 bit */
  1224.                   Jedec.GALAC0 = bit;
  1225.  
  1226.                 if (n >= 5 && n <= 8)               /* AC1 bits */
  1227.                   Jedec.GALAC1[n - 5] = bit;
  1228.  
  1229.                 if (n >= 9 && n <= 72)              /* PT0-PT63 */
  1230.                   Jedec.GALPT[n - 9] = bit;
  1231.  
  1232.                 if (n == 77)                        /* SYN bit */
  1233.                   Jedec.GALSYN = bit;
  1234.  
  1235.                 if (n >= 73 && n <= 76)             /* AC1 bits */
  1236.                   Jedec.GALAC1[n - 69] = bit;
  1237.  
  1238.                 if (n >= 78)                        /* XOR bits */
  1239.                   Jedec.GALXOR[n - 74] = bit;
  1240.             }
  1241.         }
  1242.     }
  1243.  
  1244.                                         /*** 22V10 ***/
  1245.     if (GALType == GAL22V10)
  1246.     {
  1247.         SetARCH(1);                                 /* select ACW */
  1248.         STRImpuls(VERIFY_TIME);
  1249.  
  1250.         for (n = 0; n < 10; n++)
  1251.         {
  1252.             Jedec.GALS1[n] = (BYTE)SDOut();         /* get S1x  */
  1253.             Clock();
  1254.  
  1255.             Jedec.GALXOR[n]  = (BYTE)SDOut();       /* get XORx */
  1256.             Clock();
  1257.         }
  1258.     }
  1259.  
  1260.                                         /*** 20RA10 ***/
  1261.     if (GALType == GAL20RA10)
  1262.     {
  1263.         SetARCH(1);                                 /* select ACW */
  1264.         STRImpuls(VERIFY_TIME);
  1265.  
  1266.         for (n = 0; n < 10; n++)
  1267.         {
  1268.             Jedec.GALXOR[n] = (BYTE)SDOut();        /* get XORx */
  1269.             Clock();
  1270.         }
  1271.     }
  1272.  
  1273.     ExitEditMode();
  1274. }
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280. /******************************************************************************
  1281. ** SetSecurity()
  1282. *******************************************************************************
  1283. ** input:   flag  0: call from the program GAL function because of a set
  1284. **                   JEDEC security bit
  1285. **                1: call from any other function
  1286. **
  1287. ** output:  none
  1288. **
  1289. ** remarks: this function does set the GAL's security bit
  1290. ******************************************************************************/
  1291.  
  1292. void SetSecurity(int flag)
  1293. {
  1294.     int result;
  1295.  
  1296.  
  1297.     if (flag)
  1298.         result = GALTypeRequest(AppStrings[MSG_SET_SEC].as_Str);
  1299.     else
  1300.         result = TxtRequest(AppStrings[MSG_SET_SEC].as_Str,
  1301.                             AppStrings[MSG_CONT_GAD].as_Str,
  1302.                             AppStrings[MSG_CANCEL_GAD].as_Str);
  1303.  
  1304.  
  1305.     if (result)
  1306.     {
  1307.  
  1308.         if (flag)
  1309.             if (ReadGALParameter(YES))      /* get the GAL's parameters */
  1310.                 return;
  1311.  
  1312.         LED(ON);
  1313.  
  1314.         EditMode(PROG);
  1315.  
  1316.         SetRow(SECURITY_ADR);               /* select security fuse */
  1317.  
  1318.         SetPV(PROG);                        /* set P/V to "program" */
  1319.         STRImpuls(prog_time);               /* program row          */
  1320.         SetPV(VERIFY);                      /* reset P/V            */
  1321.  
  1322.         ExitEditMode();
  1323.  
  1324.         if (flag)
  1325.             TxtRequest(AppStrings[MSG_SEC_IS_SET].as_Str,
  1326.                        AppStrings[MSG_CONT_GAD].as_Str, NULL);
  1327.     }
  1328. }
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334. /******************************************************************************
  1335. ** Loeschen()  (means Erase())
  1336. *******************************************************************************
  1337. ** input:   none
  1338. ** output:  none
  1339. **
  1340. ** remarks: This function does erase a GAL.
  1341. ******************************************************************************/
  1342.  
  1343. void Loeschen(void)
  1344. {
  1345.     int result;
  1346.  
  1347.  
  1348.     if (GALTypeRequest(AppStrings[MSG_ERASE_GAL].as_Str))
  1349.     {
  1350.  
  1351.         if (ReadGALParameter(YES))
  1352.             return;
  1353.  
  1354.         EraseIt();
  1355.  
  1356.         if (Config.EraseEmptyTest)      /* test whether or not the */
  1357.         {                               /* GAL is erased?          */
  1358.  
  1359.             PrintText(AppStrings[MSG_GAL_ERASED].as_Str, 1);
  1360.  
  1361.             PrintText(AppStrings[MSG_EXE_BLANK_TEST].as_Str, 1);
  1362.  
  1363.             result = CheckGAL();
  1364.  
  1365.             PrintText(AppStrings[MSG_READY].as_Str, 0);
  1366.  
  1367.             if (result)
  1368.             {
  1369.                 TxtRequest(AppStrings[MSG_ERASE_FAILED].as_Str,
  1370.                            AppStrings[MSG_CANCEL_GAD].as_Str, NULL);
  1371.                 return;
  1372.             }
  1373.         }
  1374.  
  1375.         TxtRequest(AppStrings[MSG_ERASED].as_Str,
  1376.                    AppStrings[MSG_CONT_GAD].as_Str, NULL);
  1377.     }
  1378. }
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384. /******************************************************************************
  1385. ** EraseIt()
  1386. *******************************************************************************
  1387. ** input:   none
  1388. ** output:  none
  1389. **
  1390. ** remarks: This function does erase a GAL.
  1391. **          ReadGALParameter should be called before calling this function!
  1392. ******************************************************************************/
  1393.  
  1394. void EraseIt(void)
  1395. {
  1396.  
  1397.     LED(ON);
  1398.  
  1399.     EditMode(PROG);
  1400.  
  1401.  
  1402.     if (GALType == GAL16V8 || GALType == GAL20V8)
  1403.     {
  1404.         SetRow(ERASE_ADR);
  1405.         SDIn(1);
  1406.  
  1407.         SetPV(PROG);                        /* set P/V to "program" */
  1408.         STRImpuls(bulk_time);               /* execute bulk erase   */
  1409.         SetPV(VERIFY);                      /* reset P/V            */
  1410.     }
  1411.  
  1412.  
  1413.     if (GALType == GAL22V10)
  1414.     {
  1415.         SDIn(1);
  1416.         SetPV(PROG);
  1417.         SetANDBE(1);
  1418.         SetARCH(1);
  1419.         SetBE(1);
  1420.         SetCLR(1);
  1421.         SetERASE(1);
  1422.  
  1423.         STRImpuls(bulk_time);               /* execute bulk erase */
  1424.  
  1425.         SetPV(VERIFY);
  1426.         SetANDBE(0);
  1427.         SetARCH(0);
  1428.         SetBE(0);
  1429.         SetCLR(0);
  1430.         SetERASE(0);
  1431.     }
  1432.  
  1433.  
  1434.     if (GALType == GAL20RA10)
  1435.     {
  1436.         SDIn(1);
  1437.         SetPV(PROG);
  1438.         SetPESSAVE(1);
  1439.         SetARCH(1);
  1440.         SetBE(1);
  1441.         SetCLR(1);
  1442.  
  1443.         STRImpuls(bulk_time);               /* erase ACW */
  1444.  
  1445.         SetARCH(0);
  1446.  
  1447.         STRImpuls(bulk_time);               /* erase AND array */
  1448.  
  1449.         SetPV(VERIFY);
  1450.         SetPESSAVE(0);
  1451.         SetBE(0);
  1452.         SetCLR(0);
  1453.     }
  1454.  
  1455.  
  1456.     ExitEditMode();
  1457.  
  1458. }
  1459.  
  1460.